<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!-- Merchant Info -->
            <div class="panel-body m-info-div">
                <h1 class="context-title">商户信息</h1>
                <c:if test="${msg}">
                	<div class="alert alert-success" role="alert" style="margin: 10px 20px;">修改成功！</div>
                </c:if>
                
                    <div class="form-group">
                        <label class="control-label" for="usr">Owner name</label>
                        <div class="input-group">
                            <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span> </span>
                            <input type="text" class="form-control" id="usr" name="usr" placeholder="" value="${merchant.mPersonName }" disabled >
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="tel">Telephone</label>
                        <div class="input-group">
                            <span class="input-group-addon"><span class="glyphicon glyphicon-phone"></span> </span>
                            <input type="text" class="form-control" id="tel" name="tel" placeholder="" value="${merchant.mTel }" disabled>
                        </div>
                    </div>
                    <div class="form-group">
                        <label>Password</label>
                		<div class="input-group">
                          	<a type="button" href="${pageContext.request.contextPath }/homes/linkPwd" class="btn btn-default">Change Password</a>
                      	</div>
                    </div>
                    
                    <div class="form-group">
                        <label for="id_card">ID Card</label>
                    </div>
                    <div class="form-group">
                        <img src="${myPicServer }${merchant.mCardPath }">
                    </div>
                    <div class="form-group">
                    	<label>Account status：</label>
                    	<div class="input-group">
	                    	<c:if test="${state == 1 }">
	                    		<span style="color:gold"><i class="fa fa-meh-o" aria-hidden="true"></i>审核中</span>
	                    	</c:if>
	                    	<c:if test="${state == 2 }">
	                    		<span style="color:green"><i class="fa fa-smile-o" aria-hidden="true"></i>已通过</span>
	                    	</c:if>
	                    	<c:if test="${state == 3 }">
	                    		<span style="color:red"><i class="fa fa-frown-o" aria-hidden="true"></i>未通过</span>
	                    	</c:if>
	                    	<c:if test="${state == 4 }">
	                    		<span style="color:red"><i class="fa fa-frown-o" aria-hidden="true"></i>&nbsp;黑名单</span>
	                    	</c:if>
                    	</div>
                    </div>
 				<form role="form" action="${pageContext.request.contextPath }/homes/editInfo" method="post"  class="login-form" enctype="multipart/form-data">
                    <div class="form-group">
                        <label for="location">Location</label>
                        <div class="input-group">
                            <span class="input-group-addon"><span class="glyphicon glyphicon-home"></span> </span>
                            <input type="text" class="form-control" id="location" name="location" placeholder="" value="${merchant.mLocation}">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="brand">Brand</label>
                        <div class="input-group">
                            <span class="input-group-addon"><span class="glyphicon glyphicon-info-sign"></span> </span>
                            <input type="text" class="form-control" id="brand" name="brand" placeholder="" value="${merchant.mBrand }">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="logo">Brand Pic</label>
                        <div class="input-group">
                        	<img src="${myPicServer }${merchant.mLogoPath }" >
                        </div>
                    </div>
                    <div class="form-group">
                   		<input type="file" class="" id="logo" name="logo">
                        <p class="help-block">The Brand picture could help customer recognize your merchant easily</p>
	                </div>
	                <span id="edit-alert" class="red-span" style="margin-left:20px;"></span><br>
	                <br>
	                <c:choose>
	                	<c:when test="${state ==  2 || state == 3 }">
	                		<div class="form-group">
                        		<button type="submit" class="btn btn-common login-btn" id="save-btn">Save</button>
                    		</div>
	                	</c:when>
	                	<c:otherwise>
	                		<div class="form-group">
                        		<button type="button" class="btn btn-common login-btn" id="save-btn" disabled>Save</button>
                    		</div>
	                	</c:otherwise>
	                </c:choose>
                </form>
            </div>
            
            
            
            
<!-- <script type="text/javascript">

	 $(function(){
		
		$("#save-btn").on("click",function(){
			var files = $('input[name="logo"]').val();
          $.ajax({
              url:"editInfo",
              type:"post",
              data:{location:$("#location").val(),brand:$("#brand").val(),logo:files},
              success:function(d){
            	  if(d.status){
            		  $("#edit-alert").html("恭喜，修改成功！");
            	  }else{
            		  $("#edit-alert").html("对不起，修改失败！");
            	  }
              }
          })
      	});
		
	}); 
	
</script> -->